/**
 * index
 */
let loginU={};
layui.use(['jquery', 'layer', 'miniAdmin','miniTongji'], function () {
    let $ = layui.jquery,
        layer = layui.layer,
        miniAdmin = layui.miniAdmin;
    let u=localStorage.getItem("ADMIN_LOGIN");
    if(u==undefined){
        layer.msg('请登录', {
            icon: 1,
            time: 500
        },function () {
            window.location = 'logout';
        });
    }else{
        loginU=decryptLocalStorage(u);
        $('#adminName').text(loginU.trueName);
    }
    /** set time **/
    setInterval(function(){
        checkLogin(layer);
    },1000*60*1);
    var options = {
        iniUrl: "admin/v1/init?token="+loginU.token,    // 初始化接口
        clearUrl: "api/clear.json", // 缓存清理接口
        urlHashLocation: true,      // 是否打开hash定位
        bgColorDefault: false,      // 主题默认配置
        multiModule: true,          // 是否开启多模块
        menuChildOpen: false,       // 是否默认展开菜单
        loadingTime: 0,             // 初始化加载时间
        pageAnim: true,             // iframe窗口动画
        maxTabNum: 20,              // 最大的tab打开数量
    };
    miniAdmin.render(options);

    $('.login-out').on("click", function () {
        layer.msg('退出登录成功', {
            icon: 1,
            time: 500
        },function () {
            window.location = 'logout';
        });
    });

    // $(window).resize(function() {
    //     let containerHeight=$('.layui-tab-content').height();
    //     localStorage.setItem("containerHeight",containerHeight);
    // });


});

let _this;
new Vue({
    el: '#appContainVue',
    data: {
        loginU:{}
    },
    mounted() {
        _this = this;
        let u=localStorage.getItem("ADMIN_LOGIN");
        let loginU={};
        if(u!=undefined){
            loginU=decryptLocalStorage(u);
            this.loginU=loginU;
        }
    },
    methods:
        {
        }
});






